
import 'package:boss/ui/page/reportForm/order/provider/order_provider.dart';
import 'package:boss/ui/page/reportForm/order/widget/order_status_card.dart';
import 'package:hi_common/hi_common.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

class OrderStatusBar extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.symmetric(
        horizontal: 30.w,
        vertical: 20.w,
      ),
      child: Consumer<OrderProvider>(
        builder: (context, orderProvider, _) {
          List<Widget> children = [];

          orderProvider.orderHeader?.orderPropDetailHeadVOList?.forEach((item) {
            children.add(OrderStatusCard(
              data: item,
              isSelected: orderProvider.type == item.type,
              onTap: () {
                orderProvider.setType(item.type);
              },
            ));
          });

          return Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: children,
          );
        },
      ),
    );
  }
}
